package com.request.strategy;

import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;

import java.lang.annotation.Annotation;

/**
 * 解析RequestBody注解的参数
 *
 * @author yuanqinglong
 * @since 2021/10/18 12:08
 */
@Component
public class RequestBodyProcessor implements RequestParamTypeProcess {


    @Override
    public Class<?> paramType() {
        return RequestBody.class;
    }

    @Override
    public void process(JSONObject requestData, Annotation annotationType, Object args) {
        JSONObject parseObject = JSONObject.parseObject(JSONObject.toJSONString(args));
        requestData.putAll(parseObject);
    }


}
